package sample1;
import java.io.IOException;  
  
import com.rabbitmq.client.Channel;  
import com.rabbitmq.client.Connection;  
import com.rabbitmq.client.ConnectionFactory;  

public class PublishTest {
	 private final static String QUEUE_NAME = "JREP_1";  
	/**
	 * @param args
	 * @throws IOException 
	 */
	public static void main(String[] args) throws IOException {
		 ConnectionFactory factory = new ConnectionFactory();  
	        factory.setHost("10.20.53.21");  
//		 	factory.setHost("JAY-XP-01");
	        Connection connection = factory.newConnection();  
	        Channel channel = connection.createChannel();  
	  
//	        channel.queueDeclare(QUEUE_NAME, false, false, false, null);  
	        channel.txSelect();
	        for(int index=0;index<100; index++){
		        String message = "->24: "+index;  
		        channel.basicPublish("", QUEUE_NAME, null, message.getBytes());  
		        System.out.println(" [x] Sent '" + message + "'");
	        }
	        channel.txCommit();
	  
	        channel.close();  
	        connection.close();  

	}

}
